package cate.game.play.buff.h;

import cate.game.play.buff.Buff;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.proce.action.ctx.TimeActionCtx;
import cate.game.play.proce.move.MoveCtx;
import cate.game.play.skill.effect.SkillEffect;

/**
 * 免疫控制技能，赤炼折枝伤害提升至300%且无冷却，持续4回合
 */
public class 魔化BH extends BuffHandler {

	private int 技能原型;

	private double 系数;

	//技能原型=？？&系数=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		技能原型 = args.getInt("技能原型", 0);
		系数 = args.getDouble("系数", 0d);
	}

	@Override
	public void onAdd(ActionCtx action) {
		buff.owner.buff.removeBuff(action, Buff::isCtrl);
	}

	@Override
	public boolean allowAddBuff(ActionCtx action, Buff buffToAdd) {
		return !buffToAdd.isCtrl();
	}

	@Override
	public void afterSelectTargets(SkillActionCtx action, SkillEffect effect) {
		if (action.getSkill().cfg.row.protoId == 技能原型) {
			action.getSkill().param.addHpCfgByCoeff(系数);
		}
	}

	@Override
	public void onOwnerMoveDone(MoveCtx move, TimeActionCtx action) {
		if (move.getSkill().cfg.row.protoId == 技能原型) {
			buff.owner.cd.refresh(move.getSkill().tid);
		}
	}
}
